//
//  MTAboutUsVC.m
//  met
//
//  Created by 李晓俊 on 2019/5/9.
//  Copyright © 2019 李晓俊. All rights reserved.
//

#import "MTAboutUsVC.h"
#import "GYWebviewctl.h"
#import "MTXieYiVC.h"
@interface MTAboutUsVC ()

@end

@implementation MTAboutUsVC

- (void)viewDidLoad {
    [super viewDidLoad];
    
    self.navigationItem.title = @"关于Met";

}
-(CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section {
    return 0.01f;
}
- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section {
    UIView *v = [UIView new];
    return v;
}
- (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section {
    return 0.01f;
}

-(UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section {
    UIView *view = [UIView new];
    return view;
}

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
    if (indexPath.row == 0) {
        //关于我们
    }else if (indexPath.row == 1) {
        //隐私条款
        [MBProgressHUD showHUDAddedTo:self.view animated:YES];
        AccountService *acc = [AccountService getObject];
        acc.httpRequestResultBlock = ^(id data,int code){
            [MBProgressHUD hideHUDForView:self.view animated:YES];
            if (code == 1) {
                if ([[NSString stringWithFormat:@"%@",[data objectForKey:@"model"]]isEqualToString:@"1"]) {
                    MTXieYiVC *vc = GetViewControllerInStoryboard(@"Mine", @"MTXieYiVC");
                    vc.name= @"隐私条款";
                    vc.content = [NSString stringWithFormat:@"%@",[data objectForKey:@"content"]];
                    [self.navigationController pushViewController:vc animated:YES];
                }else {
                
                    GYWebviewctl *clt = [[GYWebviewctl alloc] init];
                    clt.gyweb = GYWebviewctlUsr;
                    clt.jumpUrl = [NSString stringWithFormat:@"%@",[data objectForKey:@"content"]];
                    [self.navigationController pushViewController:clt animated:YES];
                }
            }else {
                [self.view maketishiToast:data];
            }
        };
        [acc findOthers:@"2"];
    }else if (indexPath.row == 2) {
        //服务协议
        [MBProgressHUD showHUDAddedTo:self.view animated:YES];
        AccountService *acc = [AccountService getObject];
        acc.httpRequestResultBlock = ^(id data,int code){
            [MBProgressHUD hideHUDForView:self.view animated:YES];
            if (code == 1) {
                if ([[NSString stringWithFormat:@"%@",[data objectForKey:@"model"]]isEqualToString:@"1"]) {
                    MTXieYiVC *vc = GetViewControllerInStoryboard(@"Mine", @"MTXieYiVC");
                    vc.name= @"服务协议";
                    vc.content = [NSString stringWithFormat:@"%@",[data objectForKey:@"content"]];
                    [self.navigationController pushViewController:vc animated:YES];
                }else {
                    
                    GYWebviewctl *clt = [[GYWebviewctl alloc] init];
                    clt.gyweb = GYWebviewctlFuwu;
                    clt.jumpUrl = [NSString stringWithFormat:@"%@",[data objectForKey:@"content"]];
                    [self.navigationController pushViewController:clt animated:YES];
                }
               
            }else {
                [self.view maketishiToast:data];
            }
        };
        [acc findOthers:@"1"];
    }
}
@end
